import request from '@/utils/request'
import type { RolesCommon } from '@/api/types/roleType'

// 获取角色信息
export type RolesCondition = Partial<{
    code: string,
    id: number,
    name: string,
    startCreateTime: string,
    endCreateTime: string,
    current: number,
    size: number
}>

export type RolesResult = Partial<{
    current: number,
    hitCount?: boolean,
    optimizeCountSql?: boolean,
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    orders?: any[],
    pages?: number,
    records: RolesListData[]
    searchCount?: boolean,
    size: number,
    total: number
}>

type RolesListData = {
    code: string,
    createBy: string,
    createTime: string,
    id: number,
    name: string,
    description: string,
    updateBy: string,
    updateTime: string,
    operatorId: number | null,

}

export function getRoles(body: RolesCondition) {
  return request<RolesCommon<RolesResult>>({
    url: '/boss/role/getRolePages',    
    method: 'post',
    data: body
  })
}